package com.itheima.controller;

import com.itheima.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Hellcontroller {

    @Value("${personName}")
    private String perName;

    @Autowired
    private Person person;


    /*
    @RequestMapping("sayHello")   支持所有请求
    RequestMapping(value = "sayHello",method = RequestMethod.GET)  支持请求
    @GetMapping("/sayHello")   表示是一个get请求资源
    @PostMapping("/sayHello")  表示是一个post请求资源
     */
    //@RequestMapping("sayHello")
    //@RequestMapping(value = "sayHello",method = RequestMethod.GET)
    @GetMapping("/sayHello")
    public String sayHello(){
        return "364 is good class";
    }
    @GetMapping("/getPerName")
    public String getPerName(){
        return perName;
    }

    public Person getPerson(){
        return person;
    }
}
